<?php

namespace service\admin;

use service\BaseService;

class PrebookSettingService extends BaseService
{
    public static $model = 'model\PrebookSettingModel';
    public static function getInfoByHospitalId($hospitalId){
        return self::getInfo(['hospital_id'=>$hospitalId]);
    }
    public static function addOrEdit($hospitalId,$num,$day,$hour){
        $info = self::getInfo(['hospital_id'=>$hospitalId]);
        $data = [
            'num'=>$num,
            'day'=>$day,
            'hour'=>$hour
        ];
        if($info){
            self::edit($info['id'],$data);
        }else{
            $data['hospital_id'] = $hospitalId;
            self::add($data);
        }
    }
}